import request from '@/utils/request'

/**
 * 修改员工角色的接口方法
 */
export const assignRoleAPI = (data) => {
  return request.put('/sys/user/assignRoles', data)
}
/**
 * 获取可用角色的接口方法
 */
export const getEnableRolesList = () => {
  return request.get('/sys/role/list/enabled')
}
/**
 * 修改员工信息接口
 */
export const updateEmloyeeAPI = data => {
  return request.put(`/sys/user/${data.id}`, data)
}
/**
 * 获取员工基本信息
 */
export const getEmloyeeDetailAPI = (id) => {
  return request.get(`/sys/user/${id}`, id)
}
/**
 * 新增员工
 */
export const addEmployeeAPI = (data) => {
  return request.post('/sys/user', data)
}
/**
 * 删除员工
 */
export const deleteEmployeeAPI = (id) => {
  return request.delete(`/sys/user/${id}`)
}
/**
 * 上传员工信息模板接口方法
 */
export const uploadExcelAPI = (formData) => {
  return request.post('/sys/user/import', formData)
}
/**
 * 下载员工信息模板接口方法
 */
export const downloadExcelAPI = () => {
  return request.get('/sys/user/import/template', {
    responseType: 'blob'
  })
}
/**
 * 导出excel表格接口方法
 */
export const exportExcelAPI = () => {
  return request.get('/sys/user/export', {
    responseType: 'blob'
  })
}
/**
 * 获取部门员工列表接口方法
 */
export const getEmployeesAPI = (params) => {
  return request.get('/sys/user', { params })
}
